package com.yangfei.mystudy1020.animation.AnimActivity;

import android.animation.ValueAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.view.animation.LinearInterpolator;

public class RotateRocketAnimationActivity extends BaseAnimationActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onStartAnimation() {
        // 1
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f, 360f);

        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                rocket.setRotation((Float) animation.getAnimatedValue());
            }
        });
        valueAnimator.setInterpolator(new LinearInterpolator());
        valueAnimator.setDuration(BaseAnimationActivity.DEFAULT_ANIMATION_DURATION);
        valueAnimator.start();
    }
}
